import Vue from 'vue';
import VuexPersistence from 'vuex-persist';
import Vuex, {Commit, Dispatch} from 'vuex';
import actions from './actions';
import getters from './getters';
import UserStore from './modules/UserStore';
import DeviceStore from '@/store/modules/DeviceStore';
import SettingStore from '@/store/modules/SettingStore';
import DataCacheStore from '@/store/modules/DataCacheStore';

Vue.use(Vuex);
const vuexLocal = new VuexPersistence({
    storage: window.localStorage,
    key: 'WEB_DATABASE',
    modules: ['UserStore', 'SettingStore', 'DataCacheStore','DeviceStore'],
});

export default new Vuex.Store({
    actions,
    getters,
    modules: {
        UserStore,
        DeviceStore,
        SettingStore,
        DataCacheStore,
    },
    plugins: [vuexLocal.plugin],
});
